package com.software.graduationproject.modules.order.entity;

import cn.hutool.core.date.DatePattern;
import com.alibaba.excel.annotation.ExcelProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.v2coding.validate.CreateGroup;
import com.v2coding.validate.UpdateGroup;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.v2coding.mybatis.model.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.*;
import java.util.Date;
import java.math.BigDecimal;

/**
 * OrderInfo : 订单表
 * ---------------------------------------------------------------------------------------------------------------------
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = true)
@TableName("order_info")
@ApiModel(value = "OrderInfo", description = "订单表")
public class OrderInfo extends BaseModel<OrderInfo> {

    @TableField(value ="shopping_cart_id")
    @ExcelProperty(value = "购物车ID")
    @ApiModelProperty(value = "购物车ID")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "购物车ID不能为空")
    private Long shoppingCartId;

    @TableField(value ="user_id")
    @ExcelProperty(value = "用户ID")
    @ApiModelProperty(value = "用户ID")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "用户ID不能为空")
    private Long userId;

    @TableField(value ="status")
    @ExcelProperty(value = "评价状态（0：未评价 1：已评价）")
    @ApiModelProperty(value = "评价状态（0：未评价 1：已评价）")
    @NotNull(groups = {CreateGroup.class, UpdateGroup.class}, message = "评价状态（0：未评价 1：已评价）不能为空")
    private Long status;

    @TableField(value ="address")
    @ExcelProperty(value = "地址")
    @ApiModelProperty(value = "地址")
    @Size(groups = {CreateGroup.class, UpdateGroup.class}, max = 255, message = "地址长度不能超过255")
    private String address;

    @TableField(value ="description")
    @ExcelProperty(value = "备注")
    @ApiModelProperty(value = "备注")
    @Size(groups = {CreateGroup.class, UpdateGroup.class}, max = 255, message = "备注长度不能超过255")
    private String description;

    @TableField(value ="mobile")
    @ExcelProperty(value = "手机号码")
    @ApiModelProperty(value = "手机号码")
    @Size(groups = {CreateGroup.class, UpdateGroup.class}, max = 11, message = "手机号码长度不能超过11")
    private String mobile;

    @TableField(value ="name")
    @ExcelProperty(value = "收货人")
    @ApiModelProperty(value = "收货人")
    @Size(groups = {CreateGroup.class, UpdateGroup.class}, max = 255, message = "收货人长度不能超过255")
    private String name;

    @TableField(value ="delivery_fee")
    @ExcelProperty(value = "配送费")
    @ApiModelProperty(value = "配送费")
    private Double deliveryFee;
}
